package com.example.api.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.Serializable;

/**
 * @Description API版本配置参数
 * @Author jie.zhao
 * @Date 2021/9/9 16:14
 */
@ConfigurationProperties(prefix = "api-version")
public class ApiVersionConfigProperties implements Serializable {

    /**
     * 接口类型
     * <p>
     * param 通过参数来区别 http://xxx.com/get?version=1.0.0
     * header 通过header里的参数来区别 http://xxx.com/get 请求header中version=1.0.0
     * uri 通过路径控制 http://xxx.com/v1.0.0/get
     */
    private ApiTypeEnum type = ApiTypeEnum.URI;

    /**
     * 版本请求头名称
     */
    private String header = "version";

    /**
     * 版本请求参数名称
     */
    private String param = "version";

    public ApiTypeEnum getType() {
        return type;
    }

    public void setType(ApiTypeEnum type) {
        this.type = type;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        this.param = param;
    }
}
